/*
 * Títutlo: PanelPista.java
 * Autor: Oswaldo Ceballos Zavala (Inu)
 * Descripción: 
 * 
 * Universidad Autónoma de Yucatán
 * 
 */

package aerodromo.view;


import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Toolkit;


/**
 *
 * @author Oswaldo.C
 */
public final class PanelPista extends javax.swing.JPanel {
    
   /******
    * 
    * DATA ABOUT THE PLANE SPRITE
    * 
    * 
    ******/   
   SpriteAvion sprite;
   
   
   public PanelPista() {     
        
      initComponents();  
      
      //crea el sprite
      sprite = new SpriteAvion();
    }
        
    
    @Override
    public void paint(Graphics g) {
        
        super.paint(g);

        Graphics2D g2d = (Graphics2D)g;
        g2d.drawImage( sprite.getImage() , sprite.getX() , sprite.getY() , this);

        Toolkit.getDefaultToolkit().sync();
        g.dispose();
    }
    
    public void forwardSprite(){
        sprite.forward();
    }
    
    public void inicializarSprite(){
        sprite.setY(525);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        setBackground(new java.awt.Color(102, 102, 102));

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 97, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 400, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    // End of variables declaration//GEN-END:variables

    
} //fin clase PanelPista
